<?php 
  require_once('nav.php');

$sql="select * from videotype";
$type_list=fetch_array($sql);
//var_dump($categary_list);
 
  //用户id是通过GET方法提交的   
   //根据用户id从数据库中查询用户的所有信息
   $id = $_GET['id'];  
   $sql = "select * from videos where vid={$id}";   
   //$result = mysql_query($sql) or die('查询失败！'.mysql_error());   
   //$row = mysql_fetch_assoc($result);
   $row=fetch_one($sql);
  // $row = fetch_one($sql);
   //var_dump($row);   
  //将查询结果显示在表单中
 ?>

        <div class="col-sm-9 col-md-10">
        <h1 class="text-center">视频编辑</h1>
        <form method="post"  action="videoupdate.php"  enctype="multipart/form-data" class="form-horizontal">
          <input type="hidden" name="id" value="<?php echo $id; ?>">

          <div class="form-group">
              <label for="videoname" class="col-md-2 col-xs-3 control-label">视频名称</label>
              <div class="col-md-10 col-xs-9">
                <input type="text" class="form-control" id="videoname" placeholder="视频名称" name="videoname" value="<?php $row['videoname'];?>">
              </div>
          </div>

          <div class="form-group">
              <label for="tid" class="col-md-2 col-xs-3 control-label">视频类型</label>
           <div class="col-md-10 col-xs-9">
     <select name="tid" class="form-control" id="tid" >
      <option>==请选择==</option>
      <?php 
      foreach ($type_list as $one) {
        echo '<option value="'.$one['tid'].'">'.$one['typename'].'</option>';
      }
       ?>
      
    </select>
           </div>
 
          <div class="form-group">
              <label for="pic" class="col-md-2 col-xs-3 control-label">视频海报</label>
              <div class="col-md-10 col-xs-9">
                  <img src='../images/<?php  echo $row['pic'];  ?>' class="img-circle">
                  <input type="file" name="pic">
              </div>
          </div>

                  <div class="form-group">
              <label for="intro" class="col-md-2 col-xs-3 control-label">视频简介</label>
              <div class="col-md-10 col-xs-9">
                <textarea class="form-control" rows="3" name="intro"><?php  echo $row['intro'];  ?></textarea>
              </div>
          </div>

           <div class="form-group">
              <label for="addressaddress" class="col-md-2 col-xs-3 control-label">下载地址</label>
              <div class="col-md-10 col-xs-9">
                <input type="text" class="form-control" id="address" placeholder="下载地址" name="address" value="<?php $row['address'];?>">
              </div>
          </div>

            <div class="form-group">
              <label class="col-md-2 col-xs-3 control-label"></label>
                <div class="col-md-10 col-xs-9">
            <button type="submit" class="btn btn-default">提交</button>
            <button type="reset" class="btn btn-default">重置</button>
              </div>
          </div>
        </form>
        </div>

<?php
  require_once('footer.php');
    ?>

